<template>
	<view class="user">
		<!-- 底图 - 开始 -->
		<image class="user-header-image" src="../../static/index_banner.png"></image>
		<!-- 底图 - 结束 -->

		<!-- 用户信息 - 开始 -->
		<view class="user-info-box">
			<!-- <u-avatar :src="userInfo.avg?userInfo.avg:user_avg" shape="square"></u-avatar> -->
			<image :src="userInfo.avg?userInfo.avg:user_avg" mode="" class="ProfilePhoto"></image>
			<view class="user-info-right">
				<view class="user-nickname">{{ userInfo.nickName?userInfo.nickName:user_name }}</view>
				<view class="user-phone" v-if="userInfo.phone">
					{{ userInfo.phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') }}</view>
			</view>
		</view>
		<!-- 用户信息 - 结束 -->

		<!-- 列表菜单 - 开始 -->
		<view class="user-activity-menu">
			<view class="menu-item" @click="Myproject">
				<view class="left">
					<image class="menu-icon" src="../../static/icon/icon_order.png"></image>
					<view class="menu-name">我的项目</view>
				</view>
			</view>
			<view class="menu-item">
				<view class="left">
					<image class="menu-icon" src="../../static/icon/icon_userinfo.png"></image>
					<view class="menu-name">个人资料</view>
				</view>
			</view>
			<view class="menu-item">
				<navigator class="menu-item" url="../../pages/tesk/tesk" hover-class="navigator-hover">
				<view class="left">
					<image class="menu-icon" src="../../static/icon/icon_order.png"></image>
					<view class="menu-name">我的任务</view>
				</view>
				</navigator>
			</view>
			<view class="menu-item">
				<view class="left">
					<image class="menu-icon" src="../../static/icon/icon_contact.png"></image>
					<view class="menu-name">联系我们</view>
				</view>
			</view>
			<view class="menu-item">
				<view class="left">
					<image class="menu-icon" src="../../static/退出.png"></image>
					<view class="menu-name" @click="quit">退出登录</view>
				</view>
			</view>
		</view>
		<!-- 列表菜单 - 结束 -->
	</view>
</template>

<script setup>
	import {
		ref,
		onMounted
	} from "vue"
	const user_avg = ref("")
	const user_name = ref("")
	const userInfo = ref({})

	const loud = () => {
		// console.log("ss",sessionStorage.getItem("UserName"))
		user_name.value = sessionStorage.getItem("UserName")
		user_avg.value = "../../static/icon/icon_userinfo.png"
	}
	const quit =()=>{
		uni.navigateTo({
			url:"../Login/Login"
		});
	}
	const Myproject = ()=>{
		wx.switchTab({
			url: '/pages/MyProject/MyProject'
		})
	}
	onMounted(() => {
		loud();
	})
</script>

<style>
	page {
		background: #F4F4F4;
	}
</style>

<style lang="scss">
	.ProfilePhoto {
		width: 100rpx;
		height: 100rpx;
		border-radius: 10rpx;
	}

	.user {
		.user-header-image {
			width: 100%;
		}

		.user-info-box {
			background: #ffffff;
			padding: 30rpx;
			margin: -80rpx 20rpx 20rpx 20rpx;
			position: relative;
			border-radius: 20rpx;
			display: flex;
			align-items: center;

			.user-avg {
				width: 100rpx;
				height: 100rpx;
				border-radius: 10rpx;
			}

			.user-nickname {
				margin-left: 20rpx;
			}

			.user-phone {
				margin-left: 20rpx;
				font-size: 24rpx;
				color: #666666;
			}
		}

		.user-recharge-wrapper {
			background: #ffffff;
			border-radius: 20rpx;
			padding: 30rpx;
			margin: 20rpx;

			.user-recharge-box {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 20rpx;

				.recharge-info {
					.info-title {
						color: #333;
						font-size: 28rpx;
						font-weight: bold;
					}

					.info-content {
						color: #999;
						font-size: 24rpx;
					}
				}

				.recharge-button {
					// background: #ff4131;
					color: #333;
					padding: 10rpx 20rpx;
					font-size: 22rpx;
					border-radius: 50rpx;
					flex-shrink: 0;
					border: 1rpx solid #dadbde;
				}
			}

			.recharge-user-money {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-top: 20rpx;
				font-size: 26rpx;
				color: #333;

				.recharge-money {
					font-weight: bold;
					font-size: 30rpx;
				}

				.recharge-money::first-letter {
					font-size: 22rpx;
				}
			}
		}

		.user-activity-menu {
			padding: 30rpx;
			margin: 20rpx;
			border-radius: 20rpx;
			background: #fff;

			.menu-item {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-top: 60rpx;

				.left {
					display: flex;
					align-items: center;

					.menu-icon {
						width: 40rpx;
						height: 40rpx;
					}


					.menu-name {
						font-size: 28rpx;
						margin-left: 20rpx;
						color: #333;
					}
				}

				.menu-number {
					font-size: 30rpx;
					color: #666666;
					letter-spacing: 2rpx;
				}
			}

			.menu-item:first-child {
				margin-top: 0;
			}
		}
	}
</style>